{template header}


    {template sidebar}

    <!-- artile begin -->
    <div class="article">
        {template title}

    <!--{if $type == 'optimize' or $type == 'back'}-->
        <table>
            <tr>
                <th width="5%"><input type="checkbox" class="all" title="全选/反选" style="cursor: pointer;"/></th>
                <th>表名称</th>
                <th width="15%">状态</th>
                <th width="10%">记录</th>
                <th width="10%">大小</th>
            </tr>

        <!--{if $tables}-->
            <!--{loop $tables $t}-->
            <tr>
                <td><input type="checkbox" name="id" value="{$t['Name']}" /></td>
                <td>{$t['Name']}</td>
                <td>{$t['Data_free'] <= 0 ? '正常' : '<b style="color: blue;">需要修复</b>'}</td>
                <td>{$t['Rows']}</td>
                <td>{echo formatFileSize($t['Data_length'] + $t['Index_length'], 1)}</td>
            </tr>
            <!--{/loop}-->
        <!--{/if}-->

            <tr>
                <td class="over"><input type="checkbox" class="all checkbox" title="全选/反选" style="cursor: pointer;"/></td>
                <td colspan="4" class="td2 operate multiple over">
                    <!--{if $type == 'optimize'}-->
                    <a href="{$this->url($c, 'optimize')}" title="修复表">修复表</a>
                    <!--{else}-->
                    <a href="{$this->url($c, 'back')}" title="备份数据">备份数据</a>
                    <!--{/if}-->
                </td>
            </tr>
            <script type="text/javascript">
                $( ".all" ).attr( 'checked', true );
                $( 'input[name="id"]' ).attr( 'checked', true );
            </script>
        </table>
    <!--{/if}-->
    <!--{if $type == 'restore'}-->
        <table>
            <tr>
                <th class="td2">备份文件</th>
                <th width="20%">备份时间</th>
                <th width="10%">大小</th>
                <th width="15%">操作</th>
            </tr>

        <!--{if $backFiles}-->
            <!--{loop $backFiles $t}-->
            <tr>
                <td class="td2">{$t['name']}</td>
                <td>{echo date($this->setting['timeformat'],$t['time'])}</td>
                <td>{echo formatFileSize($t['size'])}</td>
                <td class="operate">
                    <a href="{$this->url($c, 'del_back', array('v'=>$t['time'] ) )}" title="删除备份文件">删除</a>
                    <a href="{$this->url($c, 'restore', array('v'=>$t['time'] ) )}" title="恢复数据">恢复</a>
                </td>
            </tr>
            <!--{/loop}-->
        <!--{else}-->
            <tr>
                <td colspan="4">没有备份文件！</td>
            </tr>
        <!--{/if}-->
        </table>
        <script type="text/javascript">
            $(function(){
                $(".operate a").click(function(){
                    var obj = $( this );
                    var url = obj.attr( 'href' );
                    var text = obj.attr( 'title' );
                    if( obj.index() == 0 ){
                        $.jBox.confirm( "确定删除备份文件?", "提示", function ( v ) {
                            if ( v == true ) {
                                ajaxGET( url, text );
                            }
                        }, { buttons:{ '继续':true, '取消':false} } );
                    }else{
                        ajaxGET( url, text );
                    }
                    return false;
                } );
            });
        </script>
    <!--{/if}-->
    <!--{if $type == 'sql'}-->
        <form method="post" action="{$this->url($c, 'run_sql')}">
        <table>
            <tr>
                <th class="td2">注意：不支持查询语句。</th>
            </tr>
            <tr>
                <td class="td2">
                    <textarea name="sql" placeholder="请输入SQL语句" cols="60" rows="5" class="required"></textarea>
                </td>
            </tr>
            <tr>
                <td class="td2 operate over">
                    <a href="" class="save">运行SQL</a>
                </td>
            </tr>
        </table>
        </form>
    <!--{/if}-->
    </div>
    <!-- artile end -->
{template footer}